package com.cctc.rds.scheduler.server.raft.helper;

import com.cctc.rds.raft.core.client.command.RaftCommandClient;

import java.util.concurrent.atomic.AtomicReference;

/**
 * RaftCommandClient 客户端持有类。
 */
public class RaftCommandClientHolder {
    private static final AtomicReference<RaftCommandClient> RAFT_COMMAND_CLIENT_HOLDER = new AtomicReference<>(null);

    public static void holdRaftCommandClient(RaftCommandClient client) {
        RAFT_COMMAND_CLIENT_HOLDER.set(client);
    }

    public static RaftCommandClient getRaftCommandClient() {
        return RAFT_COMMAND_CLIENT_HOLDER.get();
    }

}
